#ifndef BOSS_Afterburner_YamlLoader_H
#define BOSS_Afterburner_YamlLoader_H

#include "RooGlobalFunc.h"
#include "TString.h"
#include <vector>
#include <yaml-cpp/yaml.h>

/// @addtogroup Afterburner_objects
/// @{

/// @author   Remco de Boer 雷穆克 (r.e.deboer@students.uu.nl or remco.de.boer@ihep.ac.cn)
/// @date     January 24th, 2019
class YamlLoader : public YAML::Node
{
public:
  YamlLoader(const TString& path);
  const char* GetPath() { return fPath.Data(); }
  const char* GetConfigName() { return fName.Data(); }

  static const char* LastLoadedConfigName() { return fLoadedConfigs.back().Data(); }
  static const char* LastLoadedConfigPath() { return fLoadedPaths.back().Data(); }

private:
  const TString fPath;
  const TString fName;

  static std::vector<TString> fLoadedPaths;
  static std::vector<TString> fLoadedConfigs;

  void SetIoSettings(const YAML::Node& input);
  void SetStatLegend(const YAML::Node& input);
  void SetRooFitOutputLevel(const YAML::Node& input);
  void SetRooFitOutputLevel_helper(RooFit::MsgLevel input);
  void SetRootOutputLevel(const YAML::Node& input);
  void SetCanvasTitle(const YAML::Node& input);
};

/// @}
#endif